import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '订单流水号',
    dataIndex: 'serialId',
    width: 160,
  },
  {
    title: '贵宾厅名称',
    dataIndex: 'roomName',
    width: 160,
  },
  {
    title: '使用人姓名',
    dataIndex: 'contactName',
    width: 100,
  },
  {
    title: '使用人联系电话',
    dataIndex: 'contactPhone',
    width: 100,
  },
  {
    title: '数量',
    dataIndex: 'buyCount',
    width: 80,
  },
  {
    title: '发车时间',
    dataIndex: 'startTime',
    width: 150,
  },
  {
    title: '身份证号',
    dataIndex: 'cardNo',
    width: 150,
  },
  {
    title: '列车号',
    dataIndex: 'batchNo',
    width: 100,
  },
  {
    title: '行程',
    dataIndex: 'trip',
    width: 100,
  },
  {
    title: '预约状态',
    dataIndex: 'state',
    width: 100,
    align: 'center',
    customRender: ({ record }: Recordable) => {
      const states = [
        { label: '待预约', value: '1' },
        { label: '预约成功', value: '2' },
        { label: '预约失败', value: '3' },
        { label: '已退订', value: '4' },
      ];
      const state: any = states.find((item) => item.value == record.state);
      if (state) {
        return state.label;
      }
      return '';
    },
  },
  {
    title: '创建日期',
    dataIndex: 'createDate',
    width: 150,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'roomName',
    label: '贵宾厅',
    component: 'Input',
    colProps: { span: 5 },
  },
  {
    field: 'contactName',
    label: '姓名',
    component: 'Input',
    colProps: { span: 5 },
  },
  {
    field: 'contactPhone',
    label: '电话',
    component: 'Input',
    colProps: { span: 5 },
  },
];
